const install = (Vue, vm) => {

	let check = () => {
		let LoginUser = uni.getStorageSync('LoginUser') ? uni.getStorageSync('LoginUser') : {}
		if (JSON.stringify(LoginUser) == '{}') {
			uni.showToast({
				title: '未登陆，请先登陆',
				icon:'error',
				duration: 2000,
				success: function() {
					uni.switchTab({
						url: '/pages/admin/index'
					});
				}
			});
			return false;
		}
		return true

	}
	//给vue设置服务的名称
	vm.$u.auth = {
		check
	};
}

export default {
	install
}